package cn.sunxyz.behavior.iterator;

/**
 * Created by yangrd on 2017/5/13.
 */
public class MyCollection<T> implements Collection<T> {

    private Object[] elementData;

    public MyCollection(T... args) {
        this.elementData = args;
    }

    @Override
    public Iterator<T> iterator() {
        return new MyIterator(this);
    }

    @Override
    public T get(int i) {
        return (T) elementData[i];
    }

    @Override
    public int size() {
        return elementData.length;
    }
}
